﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Script.Services;
using System.Web.Security;
using System.Web.Services;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class UserControlTestPage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        this.AutoCompleteTextbox1.Text = "t";
    }


    [WebMethod, ScriptMethod(ResponseFormat = ResponseFormat.Json)]
    public static object GetData(string searchTerm)
    {

        List<AutoCompleteTextbox.Answer> answers = new List<AutoCompleteTextbox.Answer>();

        AutoCompleteTextbox.Answer answer1 = new AutoCompleteTextbox.Answer();
        answer1.id = 1;
        answer1.value = "One";

        answers.Add(answer1);

        AutoCompleteTextbox.Answer answer2 = new AutoCompleteTextbox.Answer();
        answer2.id = 2;
        answer2.value = "Two";

        answers.Add(answer2);

        AutoCompleteTextbox.Answer answer3 = new AutoCompleteTextbox.Answer();
        answer3.id = 3;
        answer3.value = "Three";

        answers.Add(answer3);

        AutoCompleteTextbox.Answer answer4 = new AutoCompleteTextbox.Answer();
        answer4.id = 4;
        answer4.value = "TFour";

        answers.Add(answer4);

        AutoCompleteTextbox.Answer answer5 = new AutoCompleteTextbox.Answer();
        answer5.id = 5;
        answer5.value = "TFive";

        answers.Add(answer5);

        AutoCompleteTextbox.Answer answer6 = new AutoCompleteTextbox.Answer();
        answer6.id = 6;
        answer6.value = "TSix";

        answers.Add(answer6);

        return answers.Where(a => a.value.ToLower().StartsWith(searchTerm.ToLower()));

    }


 

}
